package com.ylb.rent.entity.vo;

import com.ylb.rent.entity.Permission;
import com.ylb.rent.entity.Role;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
import java.util.List;

/**
 * @AUTHOR:游李滨
 * @DATE:2023/6/28 21:19
 */
@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class RoleVo implements Serializable {
    private static final long serialVersionUID = 1L;
    private long id;
    private String roleName;
    private long isDelete;
    List<Permission> permissionList;

    public RoleVo(Role role){
        this.id=role.getId();
        this.roleName=role.getRoleName();
        this.isDelete=role.getIsDelete();

    }
    public RoleVo(Role role,List<Permission> permissionList){
        this.id=role.getId();
        this.roleName=role.getRoleName();
        this.isDelete=role.getIsDelete();
        this.permissionList=permissionList;

    }
    public Role getRole(){
        return new Role(this.id,this.roleName,this.isDelete);
    }
}
